module.exports = {
  Mutation: {
    testLogin: async (
      root,
      { email, password },
      { services: { $user, $auth } }
    ) => {
      // Only enabled on dev or beta server
      if (
        process.env.NODE_ENV !== 'p-tx-153' &&
        process.env.NODE_ENV !== 'dev'
      ) {
        throw new Error('Only enabled on dev or beta server')
      }
      const user = await $user.testLogin(email, password)
      return $auth.sign(user)
    }
  }
}
